package tp.pr3;

import tp.pr3.items.*;
public class Player
{
	private ItemList listaItems;
	private int livePoints;
	private int scorePoints;

	public Player()
	{
		this.listaItems = new ItemList();
		this.livePoints = 100;
		this.scorePoints = 0;

	}

	public boolean addItem(Item item)
	{
		return this.listaItems.add(item);

	}

	public Item getItem(String id)
	{
		Item objeto=null;

		int lugarItem = this.listaItems.searchItem(id);
		if (lugarItem != -1)
		{
			objeto=this.listaItems.get(lugarItem);
		}
		return objeto;

	}

	public boolean removeItem(String id)
	{
		boolean removido=false;
		
		int lugarItem = this.listaItems.searchItem(id);
		if (lugarItem != -1)
		{
			this.listaItems.remove(lugarItem);
			removido=true;
		}

		return removido;

	}

	public boolean dead()
	{
		boolean muerto=false;
		if (livePoints < 1)
		{
			muerto= true;
		}
			
		return muerto;

	}

	public int getPoints()
	{

		return this.scorePoints;

	}

	public void addPoints(int points)
	{
		this.scorePoints += points;
	}

	public int getHealth()
	{
		return this.livePoints;

	}

	public void addHealth(int health)
	{
		this.livePoints = this.livePoints+health;
	}

	public String showItems()
	{
		String lista=this.listaItems.toString();
		String mensaje="My items are:\n"+lista;
				
		if (lista==null)
		{ 
			mensaje="You are poor, you have not got any item (yet).";
		}
		return mensaje;
		//TODO salud y vida aqui abajo

	}
	
	public void getStatus()
	{
		System.out.println("HEALTH = " + this.getHealth() + ", SCORE =" + this.getPoints());
	}

}
